package com.hmall.mq;

import com.hmall.Service.SearchService;
import com.hmall.constatnts.MqConstants;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class HotelListener {

    @Autowired
    private SearchService searchService;



    @RabbitListener(queues = MqConstants.HOTEL_INSERT_QUEUE)
    public void listenSearchInsert(Long id){
        System.out.println("id="+id);
        searchService.insertById(id);

    }

    @RabbitListener(queues = MqConstants.HOTEL_DELETE_QUEUE)
    public void listSearchDelete(Long id){
        searchService.deleteById(id);
    }
}
